package com.xdwanj.ui.acitivity

import android.app.Activity
import android.os.Bundle
import android.util.Log
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.xdwanj.ui.test.R

class JumpPageActivity : AppCompatActivity() {
    private val TAG = "JumpPageActivity"

    companion object {
        const val EXTRA_DEMO = "com.xdwanj.ui.test.resultInfo"
    }

    lateinit var showText: TextView

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_jump_page)
        Log.d(TAG, "onCreate: ")

        showText = findViewById<TextView>(R.id.jump_text)

        var stringExtra = intent.getStringExtra(MainActivity.EXTRA_MAIN)

        showText.text = stringExtra

        val sp = getSharedPreferences("file", MODE_PRIVATE)

        sp.edit()?.apply {
            putString("name", "zhangsan")
            putString("username", "admin")
            putString("password", "123456")
            apply()
        }

        var name = sp.getString("name", "")
        var gender = sp.getBoolean("gender", true)

        setResult(
                Activity.RESULT_OK,
                intent.putExtra(EXTRA_DEMO, "来自跳转页面的信息")
        )
    }
}